#pragma once
#include "Buffer.h"
#include "Channel.h"
#include "EventLoop.h"
#include "HttpRequest.h"
#include "HttpResponse.h"
#include <sys/types.h>

//#define MSG_SEND_AUTO

class TcpConnection
{
  public:
    TcpConnection(int fd, EventLoop* evloop);
    ~TcpConnection();

    static int processRead(void* arg);
    static int processWrite(void* arg);
    static int destroy(void* arg);

    const ssize_t MAX_BUFFER_SIZE = 40960;

  private:
    string     m_name;
    EventLoop* m_evLoop;
    Channel*   m_channel;
    Buffer*    m_readBuf;
    Buffer*    m_writeBuf;
    // http 协议
    HttpRequest*  m_request;
    HttpResponse* m_response;
};